package tk.tankpao.spi.test;

import java.util.Iterator;
import java.util.ServiceLoader;

import tk.tankpao.spi.Search;

public class SearchFactory {
	
	private SearchFactory() {
	}

	public static Search newSearch() {
		Search search = null;
		ServiceLoader<Search> serviceLoader = ServiceLoader.load(Search.class);
		Iterator<Search> searchs = serviceLoader.iterator();
		if (searchs.hasNext()) {
			search = searchs.next();
		}
		return search;
	}
}
